package com.zyy.game.tianlong.serviceimpl;

import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.util.Base64Utils;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;

/**
 * @author relufi
 * @date 2019/8/15 0015
 */
@Service
@Slf4j
public class TaskServiceImpl {

    @Async
    public void saveFile(File path,String base64){
        try {
            Files.write(path.toPath(),Base64Utils.decodeFromString(base64));
        } catch (IOException e) {
            log.error("文件保存失败",e);
        }
    }
}
